\(\int \frac {\cos ^2(a+b x^n)}{x} \, dx\) [70]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [C] (verification not implemented)
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 14, antiderivative size = 43 \[ \int \frac {\cos ^2\left (a+b x^n\right )}{x} \, dx=\frac {\cos (2 a) \operatorname {CosIntegral}\left (2 b x^n\right )}{2 n}+\frac {\log (x)}{2}-\frac {\sin (2 a) \text {Si}\left (2 b x^n\right )}{2 n} \]

[Out]

1/2*Ci(2*b*x^n)*cos(2*a)/n+1/2*ln(x)-1/2*Si(2*b*x^n)*sin(2*a)/n

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3507, 3459, 3457, 3456} \[ \int \frac {\cos ^2\left (a+b x^n\right )}{x} \, dx=\frac {\cos (2 a) \operatorname {CosIntegral}\left (2 b x^n\right )}{2 n}-\frac {\sin (2 a) \text {Si}\left (2 b x^n\right )}{2 n}+\frac {\log (x)}{2} \]

[In]

Int[Cos[a + b*x^n]^2/x,x]

[Out]

(Cos[2*a]*CosIntegral[2*b*x^n])/(2*n) + Log[x]/2 - (Sin[2*a]*SinIntegral[2*b*x^n])/(2*n)

Rule 3456

Int[Sin[(d_.)*(x_)^(n_)]/(x_), x_Symbol] :> Simp[SinIntegral[d*x^n]/n, x] /; FreeQ[{d, n}, x]

Rule 3457

Int[Cos[(d_.)*(x_)^(n_)]/(x_), x_Symbol] :> Simp[CosIntegral[d*x^n]/n, x] /; FreeQ[{d, n}, x]

Rule 3459

Int[Cos[(c_) + (d_.)*(x_)^(n_)]/(x_), x_Symbol] :> Dist[Cos[c], Int[Cos[d*x^n]/x, x], x] - Dist[Sin[c], Int[Si
n[d*x^n]/x, x], x] /; FreeQ[{c, d, n}, x]

Rule 3507

Int[((a_.) + Cos[(c_.) + (d_.)*(x_)^(n_)]*(b_.))^(p_)*((e_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandTrigReduce[(e
*x)^m, (a + b*Cos[c + d*x^n])^p, x], x] /; FreeQ[{a, b, c, d, e, m, n}, x] && IGtQ[p, 0]

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {1}{2 x}+\frac {\cos \left (2 a+2 b x^n\right )}{2 x}\right ) \, dx \\ & = \frac {\log (x)}{2}+\frac {1}{2} \int \frac {\cos \left (2 a+2 b x^n\right )}{x} \, dx \\ & = \frac {\log (x)}{2}+\frac {1}{2} \cos (2 a) \int \frac {\cos \left (2 b x^n\right )}{x} \, dx-\frac {1}{2} \sin (2 a) \int \frac {\sin \left (2 b x^n\right )}{x} \, dx \\ & = \frac {\cos (2 a) \operatorname {CosIntegral}\left (2 b x^n\right )}{2 n}+\frac {\log (x)}{2}-\frac {\sin (2 a) \text {Si}\left (2 b x^n\right )}{2 n} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.15 (sec) , antiderivative size = 37, normalized size of antiderivative = 0.86 \[ \int \frac {\cos ^2\left (a+b x^n\right )}{x} \, dx=\frac {\cos (2 a) \operatorname {CosIntegral}\left (2 b x^n\right )+n \log (x)-\sin (2 a) \text {Si}\left (2 b x^n\right )}{2 n} \]

[In]

Integrate[Cos[a + b*x^n]^2/x,x]

[Out]

(Cos[2*a]*CosIntegral[2*b*x^n] + n*Log[x] - Sin[2*a]*SinIntegral[2*b*x^n])/(2*n)

Maple [A] (verified)

Time = 1.11 (sec) , antiderivative size = 40, normalized size of antiderivative = 0.93

method result size
derivativedivides \(\frac {-\frac {\operatorname {Si}\left (2 b \,x^{n}\right ) \sin \left (2 a \right )}{2}+\frac {\operatorname {Ci}\left (2 b \,x^{n}\right ) \cos \left (2 a \right )}{2}+\frac {\ln \left (b \,x^{n}\right )}{2}}{n}\) \(40\)
default \(\frac {-\frac {\operatorname {Si}\left (2 b \,x^{n}\right ) \sin \left (2 a \right )}{2}+\frac {\operatorname {Ci}\left (2 b \,x^{n}\right ) \cos \left (2 a \right )}{2}+\frac {\ln \left (b \,x^{n}\right )}{2}}{n}\) \(40\)
risch \(\frac {\ln \left (x \right )}{2}+\frac {i {\mathrm e}^{-2 i a} \pi \,\operatorname {csgn}\left (b \,x^{n}\right )}{4 n}-\frac {i {\mathrm e}^{-2 i a} \operatorname {Si}\left (2 b \,x^{n}\right )}{2 n}-\frac {{\mathrm e}^{-2 i a} \operatorname {Ei}_{1}\left (-2 i b \,x^{n}\right )}{4 n}-\frac {{\mathrm e}^{2 i a} \operatorname {Ei}_{1}\left (-2 i b \,x^{n}\right )}{4 n}\) \(80\)

[In]

int(cos(a+b*x^n)^2/x,x,method=_RETURNVERBOSE)

[Out]

1/n*(-1/2*Si(2*b*x^n)*sin(2*a)+1/2*Ci(2*b*x^n)*cos(2*a)+1/2*ln(b*x^n))

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 35, normalized size of antiderivative = 0.81 \[ \int \frac {\cos ^2\left (a+b x^n\right )}{x} \, dx=\frac {\cos \left (2 \, a\right ) \operatorname {Ci}\left (2 \, b x^{n}\right ) + n \log \left (x\right ) - \sin \left (2 \, a\right ) \operatorname {Si}\left (2 \, b x^{n}\right )}{2 \, n} \]

[In]

integrate(cos(a+b*x^n)^2/x,x, algorithm="fricas")

[Out]

1/2*(cos(2*a)*cos_integral(2*b*x^n) + n*log(x) - sin(2*a)*sin_integral(2*b*x^n))/n

Sympy [F]

\[ \int \frac {\cos ^2\left (a+b x^n\right )}{x} \, dx=\int \frac {\cos ^{2}{\left (a + b x^{n} \right )}}{x}\, dx \]

[In]

integrate(cos(a+b*x**n)**2/x,x)

[Out]

Integral(cos(a + b*x**n)**2/x, x)

Maxima [C] (verification not implemented)

Result contains higher order function than in optimal. Order 9 vs. order 4.

Time = 0.41 (sec) , antiderivative size = 99, normalized size of antiderivative = 2.30 \[ \int \frac {\cos ^2\left (a+b x^n\right )}{x} \, dx=\frac {{\left ({\rm Ei}\left (2 i \, b x^{n}\right ) + {\rm Ei}\left (-2 i \, b x^{n}\right ) + {\rm Ei}\left (2 i \, b e^{\left (n \overline {\log \left (x\right )}\right )}\right ) + {\rm Ei}\left (-2 i \, b e^{\left (n \overline {\log \left (x\right )}\right )}\right )\right )} \cos \left (2 \, a\right ) + 4 \, n \log \left (x\right ) + {\left (i \, {\rm Ei}\left (2 i \, b x^{n}\right ) - i \, {\rm Ei}\left (-2 i \, b x^{n}\right ) + i \, {\rm Ei}\left (2 i \, b e^{\left (n \overline {\log \left (x\right )}\right )}\right ) - i \, {\rm Ei}\left (-2 i \, b e^{\left (n \overline {\log \left (x\right )}\right )}\right )\right )} \sin \left (2 \, a\right )}{8 \, n} \]

[In]

integrate(cos(a+b*x^n)^2/x,x, algorithm="maxima")

[Out]

1/8*((Ei(2*I*b*x^n) + Ei(-2*I*b*x^n) + Ei(2*I*b*e^(n*conjugate(log(x)))) + Ei(-2*I*b*e^(n*conjugate(log(x)))))
*cos(2*a) + 4*n*log(x) + (I*Ei(2*I*b*x^n) - I*Ei(-2*I*b*x^n) + I*Ei(2*I*b*e^(n*conjugate(log(x)))) - I*Ei(-2*I
*b*e^(n*conjugate(log(x)))))*sin(2*a))/n

Giac [F]

\[ \int \frac {\cos ^2\left (a+b x^n\right )}{x} \, dx=\int { \frac {\cos \left (b x^{n} + a\right )^{2}}{x} \,d x } \]

[In]

integrate(cos(a+b*x^n)^2/x,x, algorithm="giac")

[Out]

integrate(cos(b*x^n + a)^2/x, x)

Mupad [F(-1)]

Timed out. \[ \int \frac {\cos ^2\left (a+b x^n\right )}{x} \, dx=\int \frac {{\cos \left (a+b\,x^n\right )}^2}{x} \,d x \]

[In]

int(cos(a + b*x^n)^2/x,x)

[Out]

int(cos(a + b*x^n)^2/x, x)